﻿// Original author contact info: Owen Emlen (owene_1998@yahoo.com)
// Note: other individuals may also have contributed to this code
// Project hosted on CodePlex.com as of 1/10/2009 at http://wpfimageviewer.codeplex.com
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Threading;
using System.Windows.Media.Imaging;
using AForge.Imaging;
using AForge.Imaging.Filters;
using BrainTechLLC;
using BrainTechLLC.ThreadSafeObjects;
using System.Windows.Media;
using System.Drawing.Drawing2D;
using PixelFormat = System.Drawing.Imaging.PixelFormat;

namespace BrainTechLLC.ImageOperators
{
    public enum Direction
    {
        Up = 0,
        Down = 1,
        Left = 2,
        Right = 3,
        UpLeft = 4,
        DownRight = 5,
        DownLeft = 6,
        UpRight = 7
    }

    public static partial class FileImageOperators
    {
        public static void GetXYOffset(this Direction dir, out int offsetX, out int offsetY)
        {
            offsetX = 0; offsetY = 0;

            switch (dir)
            {
                case Direction.Down:
                    offsetY = 1;
                    break;
                case Direction.Left:
                    offsetX = -1;
                    break;
                case Direction.Right:
                    offsetX = 1;
                    break;
                case Direction.Up:
                    offsetY = -1;
                    break;
                case Direction.UpLeft:
                    offsetY = -1;
                    offsetX = -1;
                    break;
                case Direction.DownRight:
                    offsetY = 1;
                    offsetX = 1;
                    break;
                case Direction.DownLeft:
                    offsetY = 1;
                    offsetX = -1;
                    break;
                case Direction.UpRight:
                    offsetY = -1;
                    offsetX = 1;
                    break;
            }
        }
    }
}
